package bootstrap

import (
	"github.com/kataras/golog"
	"ntrace/enviroments"
	"os"
)

// InitEnv 初始化全局环境变量
func InitEnv() error {
	/*
		exe, err := os.Executable()
		if err != nil {
			golog.Errorf("os.Executable() failed. err: %+v", err)
			return err
		}
	*/
	var err error
	enviroments.WorkDir, err = os.Getwd()
	if err != nil {
		golog.Errorf("os.Getwd() failed. err: %+v", err)
		return err
	}
	enviroments.PID = os.Getpid()
	enviroments.Hostname, err = os.Hostname()
	if err != nil {
		golog.Errorf("os.Hostname() failed. err: %+v", err)
		return err
	}
	return nil
}
